<%@page import="net.sf.jasperreports.engine.export.JRHtmlExporter"%>
<%@page import="net.sf.jasperreports.engine.JRPrintText"%>
<%@page import="java.util.List"%>
<%@page import="net.sf.jasperreports.engine.JasperExportManager"%>
<%@page import="java.io.OutputStream"%>
<%@page import="net.sf.jasperreports.engine.export.JRPdfExporterParameter"%>
<%@page import="net.sf.jasperreports.engine.JRExporterParameter"%>
<%@page import="net.sf.jasperreports.engine.export.JRPdfExporter"%>
<%@page import="net.sf.jasperreports.engine.JasperPrint"%>
<%@page import="net.sf.jasperreports.engine.export.HtmlExporter"%>
<%@page import="net.sf.jasperreports.j2ee.servlets.*" %>
<%@page import="net.sf.jasperreports.engine.export.JRHtmlExporterParameter"%>
<%
	response.setContentType("application/pdf");

	if(request.getParameter("title") != null) {
		if(request.getSession().getAttribute(request.getParameter("title") + request.getParameter("id")) == null)
			request.getSession().setAttribute(request.getParameter("title") + request.getParameter("id"), (JasperPrint)request.getSession().getAttribute("report_data"));
	}
	request.getSession().removeAttribute("report_data");
	JasperPrint jasperPrint = (JasperPrint)request.getSession().getAttribute(request.getParameter("title") + request.getParameter("id"));
	
	JRPdfExporter jrPDFExporter = new JRPdfExporter();
	jrPDFExporter.setParameter(JRPdfExporterParameter.JASPER_PRINT, jasperPrint);
	jrPDFExporter.setParameter(JRPdfExporterParameter.OUTPUT_STREAM,response.getOutputStream());
	jrPDFExporter.exportReport();
	%>